//
//  SubmitOrderView.swift
//  Box
//
//  Created by mn on 2025/4/1.
//

import UIKit

class SubmitOrderView: UIView{

    let titleLabel: UILabel = {
        let label = UILabel()
        label.font = UIFont.systemFont(ofSize: 12)
        label.textColor = .fromHex("#333333")
        label.text = "合计："
        return label
    }()
    
    let priceLabel: UILabel = {
        let label = UILabel()
        label.font = UIFont.systemFont(ofSize: 17.5,weight: .semibold)
        label.textColor = .init(hex: "#292D32")
        label.text = "￥7499.00"
        return label
    }()
    lazy var button: InsetBorderButton = {
        let button = InsetBorderButton(type: .custom)
        button.setTitle("提交订单", for: .normal)
        button.setTitleColor(.fromHex("#CAFE67"), for: .normal)
        button.layer.cornerRadius = 7.5
        button.titleLabel?.font = .systemFont(ofSize: 16)
        button.backgroundColor = .black
        button.borderColor = .white
        button.addAction { [weak self] in
        }
        return button
    }()
    override init(frame: CGRect) {
        super.init(frame: frame)
        setupUI()
    }

    required init?(coder: NSCoder) {
        super.init(coder: coder)
        setupUI()
    }
    
    private func setupUI() {
        backgroundColor = .white

        addSubview(titleLabel)
        addSubview(priceLabel)
        addSubview(button)
        titleLabel.snp.makeConstraints { make in
            make.centerY.equalToSuperview()
            make.left.equalToSuperview().offset(16)
        }
        
        priceLabel.snp.makeConstraints { make in
            make.bottom.equalTo(titleLabel.snp.bottom)
            make.left.equalTo(titleLabel.snp.right)
        }
        button.snp.makeConstraints { make in
            make.centerY.equalToSuperview()
            make.right.equalToSuperview().offset(-16)
            make.size.equalTo(CGSize(width: 150, height: 52))
        }
    }
}
